#pragma once
#include "widgets.h"
#include <QWidget>

class S_WIDGETS_EXPORT SDockingButton : public QWidget
{
public:
	SDockingButton(QWidget* buddy, Qt::Alignment align, QWidget* parent = nullptr);
	void setExpand(bool v);

protected:
	void mousePressEvent(QMouseEvent* event) override;
	void enterEvent(QEvent* event) override;
	void leaveEvent(QEvent* event) override;
	void paintEvent(QPaintEvent* event) override;

	bool eventFilter(QObject* watched, QEvent* event) override;

private:
	void updatePos();

private:
	Qt::Alignment	m_align = Qt::AlignLeft;
	bool			m_hover = false;
	QWidget*		m_buddy = nullptr;
	QWidget*		m_parent = nullptr;
	bool			m_expand = true;
};